<form action="<?php e_page("goods","addSubmit")?>" method="post">
    <input type="hidden" name="thumb_pic" id="thumb_pic" value="2"/>
    <input type="hidden" name="pic_ids" id="pic_ids" value="1"/>
    <fieldset>
        <legend>基本信息</legend>
        <label for="name">商品名</label>
        <input type="text" name="name" id="name" placeholder="请输入商品名" required/><br/><br/>
        <label for="type">商品类型</label>
        <select name="type" id="type">
            <option value="normal">普通商品</option>
            <option value="commodity">大宗商品</option>
            <option value="service">服务商品</option>
            <option value="non_sale">广告商品</option>
        </select><br/><br/>
        <label for="shopId">商家</label>
        <select name="shopId" id="shopId">
            <?php foreach($r['shop_info'] as $v){?>
                <option value="<?php echo $v['id']?>">No.<?php echo $v['id']?> <?php echo $v['company']?></option>
            <?php }?>
        </select><br/><br/>
        <label for="goodsCat">商品分类</label>
        <select name="goodsCat" id="goodsCat">
            <?php foreach($r['goods_cat'] as $v){?>
                <option value="<?php echo $v['id']?>"><?php echo $v['name']?></option>
            <?php }?>
        </select><br/><br/>
        <label for="unit">单位</label>
        <input type="text" name="unit" id="unit" placeholder="请输入商品单位" required><br/><br/>
        <label for="label">商品标签</label>
        <?php foreach($r['label'] as $k=>$v){?>
            <label><input type="checkbox" name="label[]" value="<?php echo $v['id']?>"/><?php echo $v['name']?></label>
        <?php }?><br/><br/>
        <label for="qq">客服QQ</label>
        <input type="text" name="qq" id="qq" placeholder="请输入客服QQ" required><br/>
        <label for="tip_id">买家须知</label>
        <select name="tip_id" id="tip_id">
            <?php foreach($r['tip'] as $v){?>
                <option value="<?php echo $v['id'] ?>"><?php echo $v['title'] ?></option>
            <?php }?>
        </select><br/><br/>
        <label for="note">购买注意</label>
        <textarea name="note" id="note" placeholder="请输入购买注意" required></textarea>
    </fieldset>
    <fieldset>
        <legend>价格信息</legend>
        <label for="original_price">原价</label>
        <input type="text" name="original_price" id="original_price" placeholder="请输入原价" required><br/>
        <label for="base_price">基本价格</label>
        <input type="text" name="base_price" id="base_price" placeholder="请输入基本价格" required><br/>
        <label for="low">少量商品数</label>
        <input type="text" name="low" id="low" placeholder="请输入少量商品数(如果不需要多级价格请留空)"><br/>
        <label for="medium_price">中等价格</label>
        <input type="text" name="medium_price" id="medium_price" placeholder="请输入中等价格(如果不需要多级价格请留空)"><br/>
        <label for="medium">大量商品数</label>
        <input type="text" name="medium" id="medium" placeholder="请输入大量商品数(如果不需要多级价格请留空)"><br/>
        <label for="high_price">最低价格</label>
        <input type="text" name="high_price" id="high_price" placeholder="请输入最低价格(如果不需要多级价格请留空)"><br/>
    </fieldset>
    <fieldset>
        <legend>产品规格</legend>
        <table class="goods_attr_table">
            <tr class="goods_attr_tr">
                <td><label>规格名称<input type="text" class="goods_attr_name" name="goods_attr[0][name]" required></label></td>
                <td><label>库存余量<input type="text" class="goods_attr_stock" name="goods_attr[0][stock]" required></label></td>
                <td><a href="javascript:" class="goods_attr_delete">删除</a></td>
            </tr>
        </table>
        <input type="button" value="添加更多属性" class="goods_attr_button"/>
        <script>
            $(function(){
            	var $goodsAttrTr=$(".goods_attr_tr");
                var $goodsAttrTpl=$goodsAttrTr.clone();
                $goodsAttrTr.find(".goods_attr_delete").remove();
                var count=0;
                $(".goods_attr_button").click(function(){
                    count++;
                    var $tmp=$goodsAttrTpl.clone();
                    $tmp.find(".goods_attr_name").attr("name","goods_attr["+count+"][name]");
                    $tmp.find(".goods_attr_stock").attr("name","goods_attr["+count+"][stock]");
                    $(".goods_attr_table").append($tmp);
                });
                $(".goods_attr_table").on("click",".goods_attr_delete",function(){
                    $(this).closest(".goods_attr_tr").remove();
                });
            })
        </script>
    </fieldset>
    <fieldset>
        <legend>分享提成信息</legend>
        <label for="bonus">分享提成</label>
        <input type="text" name="bonus" id="bonus" placeholder="请输入分享提成"/><br/>
        <label for="commission">代购提成</label>
        <input type="text" name="commission" id="commission" placeholder="请输入代购提成"/><br/>
        <label for="service_fee">服务站费用</label>
        <input type="text" name="service_fee" id="service_fee" placeholder="请输入服务站费用"/><br/>
        <label for="platform_fee">平台费用</label>
        <input type="text" name="platform_fee" id="platform_fee" placeholder="请输入平台费用"/><br/>
    </fieldset>
    <fieldset>
        <legend>产品详情</legend>
        <script id="aTextInput" name="detail" class="editor" type="text/plain">请输入产品详情</script>
    </fieldset>
    <fieldset>
        <legend>供应商详情</legend>
        <script id="supplier" name="supplier" class="editor" type="text/plain">请输入供应商详情</script>
    </fieldset>
    <input type="submit" value="保存"/>
</form>